#include <iostream>
using namespace std;

bool simple(int n)
{
    int d = 0;
    for(int i=1; i<=n; i++)
    {
        if (n%i == 0)
            d++;
    }
    if (d == 2) return true;
    return false;
}

int main()
{
    string digit[] = {"zero", "one", "two", "three", "four", "five", "six",
    "seven", "eight", "nine"};

    string s, sh, sd, se;
    int h = 0, d = 0, e = 0;
    getline(cin, s);

    sh = s.substr(0, (s.find(' ')));
    sd = s.substr(s.find(' ') + 1, s.rfind(' ') - s.find(' ') - 1);
    se = s.substr((s.rfind(' ') + 1) );


    for (int i = 0; i<10; i++)
    {
        if (sh == digit[i])
            h = i;
        if (sd == digit[i])
            d = i;
        if (se == digit[i])
            e = i;
    }
    if(simple(h * 100 + d * 10 + e))
        cout << h * 100 + d * 10 + e;
    else
        cout << "Wrong input";
}
